package com.dhj.streamTest;

import com.dhj.streamTest.entity.Author;

import java.util.Comparator;
import java.util.List;
import java.util.function.Consumer;

import static com.dhj.streamTest.entity.AuthorList.getAuthors;

public class Demo7 {

    public static void main(String[] args) {
        List<Author> authors = getAuthors();

        authors.stream().distinct().sorted().limit(2)
                .forEach(author -> System.out.println(author.getName()+"--"+author.getAge()));

    }
}
